﻿// Copyright 2012, mark.yang.d All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Author: mark.yang.d@gmail.com

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace MicroOrm
{
    public class ParameterSchema
    {
        private readonly string _parameterName;
        private readonly ProcedureSchema _procedure;
        private string _direction;
        private int _position;

        private readonly DbType _dbType;
        private readonly Type _clrType;
        private readonly int _maxLength;

        internal ParameterSchema(string parameterName, ProcedureSchema procedure, int position, DbType dbType, Type clrType)
            : this(parameterName, "IN", position, procedure, dbType, clrType, -1)
        { }

        internal ParameterSchema(string parameterName, string direction, int position, ProcedureSchema procedure, DbType dbType, Type clrType, int maxLength)
        {
            _parameterName = parameterName;
            _position = position;
            _direction = direction;
            _procedure = procedure;
            _dbType = dbType;
            _clrType = clrType;
            _maxLength = maxLength;
        }

        public string ParameterName
        {
            get { return _parameterName; }
        }

        public int Position
        {
            get { return _position; }
        }

        public ProcedureSchema Procedure
        {
            get { return _procedure; }
        }

        public DbType DbType
        {
            get { return _dbType; }
        }

        public Type ClrType
        {
            get { return _clrType; }
        }

        public int MaxLength
        {
            get { return _maxLength; }
        }

        public string Direction
        {
            get { return _direction; }
        }
    }
}
